//
// Created by 吴楷泓 on 2021/12/17.
//

#include <stdio.h>
#include <stdlib.h>

void decimal2BinaryNaiveVersion(int num) {
    int binary[16], index = 0;
    while(num) {
        binary[index++] = num % 2;
        num /= 2;
    }
    index--;
    for(; index >= 0; index--) {
        printf("%d", binary[index]);
    }
    putchar(10);
}


void decimal2BinaryEnhancedVersion(int num) {
    int binary[16], index = 0;
    while(num) {
        binary[index++] = num & 1;
        num >>= 1;
    }

    index--;
    for(; index >= 0; index--) {
        printf("%d", binary[index]);
    }
    putchar(10);
}

void decimal2BinaryMagicalVersion(int num) {
    char binaryString[16];
    itoa(num, binaryString, 2);
}


int main() {
    decimal2BinaryNaiveVersion(123);
    return 0;
}

